f = open('111.txt', 'r', encoding='utf-8')
print(f.read())

with open('111.txt', 'r', encoding='utf-8') as file:
    text = file.read()
print(text)

f1 = open(r'C:\Users\Administrator\Desktop/111.txt', encoding='utf-8')
print(f1.read())

f2 =open('222.txt', 'w', encoding='utf-8')
f2.write('嘻嘻嘻嘻哈哈哈哈呵呵呵呵')
f2.close()

date = '哇塞任嘉伦哎'
with open('222.txt', 'w', encoding='utf-8') as f:
    f.write(date)


import pandas
pd = pandas
# 读取excel表数据，获取的是dateframe对象
import pandas as pd

df = pd.read_excel(r'C:\Users\Administrator\Desktop\111.xlsx')
print(df)


#写文件到excel文件
a1 = {'name': 'xiaohong', 'age': 28}
a2 = {'name': 'xiaoliu', 'age': 26}
a3 = {'name': 'xiaolan','age': 18}
l = [a1, a2, a3]
print(l)
#需要将列表变成DataFrame格式
df1 = pd.DataFrame(l)
print(df1)
df1.to_excel('222.xlsx', index=False)